#pragma once
#ifndef LISTENER_HPP
#define LISTENER_HPP
#include <boost/asio.hpp>
#include <boost/thread/mutex.hpp>
#include "Request.hpp"

using namespace boost::asio;
class Listener {
	io_service io;
	ip::tcp::acceptor acceptor;
	ip::tcp::socket socket;

	void start_accept();
	void handle_accept(Request *r, const boost::system::error_code& error);
	void ioloop() { io.run(); }
public:
	Listener(int port);
	void run();
};

#endif
